<%@page import="com.situ.web.entity.Student"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.css"/>
<style type="text/css">

</style>

</head>
<body>

	<%
	   // jsp页面中内置了request对象，可以直接使用
		ArrayList<Student> list = (ArrayList<Student>)request.getAttribute("list");
	%>
	<table class="table table-striped table-bordered table-hover table-condensed">
		<tr>
			<th>ID</th>
			<th>名字</th>
			<th>年龄</th>
			<th>性别</th>
			<th>删除1</th>
			<th>删除2</th>
		</tr>
		<%
			for (Student student : list) {
		%>
				<tr>
					<td><%=student.getId()%></td>
					<td><%=student.getName()%></td>
					<td><%=student.getAge()%></td>
					<td><%=student.getGender()%></td>
					<!-- <td><a href="/Java1912Web/deleteStudent?id=<%=student.getId()%>">删除</a></td>-->
					<td> <a href = "javascript:void(0)" onclick = "deleteById(<%=student.getId()%>)">删除</a> </td>
					<td><a href="<%=request.getContextPath()%>/student?method=updateStudent1&id=<%=student.getId()%>">修改</a></td>
					
				</tr>
				
		<%
			}
		%>
				
	</table>
	<button class = "btn"  style=";margin:0 auto"><a href="http://localhost:8080/Java1912Web/student_insert.jsp">新增</a></button>
	<script>
		function deleteById(id) {
			var isDel = confirm("您确认要删除吗？");
			if(isDel) {
				location.href="/Java1912Web/student?method=deleteById&id=" +id;
			}
		}
	</script>
	
</body>
</html>